package com.java2_27;

public class java2_27 {
    //枚举：一个类中只能产生固定的对象且对象的信息不可修改
//    public static void main(String[] args) {
////        System.out.println(MyEnumerate.SPRING);
////        System.out.println(MyEnumerate.SUMMER);
////        MyEnumerate autumn = MyEnumerate.AUTUMN;
////        System.out.println(autumn.toString());
//        System.out.println(MyEnumerate2.SPRING);
//
//
//    }
//    public static void main(String[] args) {
////        System.out.println(MyEnumerate2.SUMMER.toString());
////        System.out.println(MyEnumerate.SPRING.toString());
////        MyEnumerate2 spring = MyEnumerate2.valueOf("SPRING");
////        System.out.println(spring);
////        MyEnumerate2[] values = MyEnumerate2.values();
////        for (int i = 0; i < values.length; i++) {
////            System.out.println(values[i]);
////        }
//        //如果没有就报错
////        MyEnumerate2 winter = MyEnumerate2.valueOf("Winter");
////        System.out.println(winter);
////        MyEnumerate2 winter1 = MyEnumerate2.valueOf("WINTER");
////        System.out.println(winter1);
////
////        //enmu -> Enum -> Object
//        //返回对象的名字
////
////        String name = MyEnumerate2.SUMMER.name();
////        System.out.println(name);
//
//        //ordinal -- 返回对象的索引值
////        int ordinal = MyEnumerate2.SUMMER.ordinal();
////        System.out.println(ordinal);
//
//        //公用一个show方法
////        MyEnumerate2.SUMMER.show();
////        MyEnumerate2.WINTER.show();
////        MyEnumerate2.AUTUMN.show();
//
////        MyEnumerate2.SPRING.show();
////        MyEnumerate2.SUMMER.show();
////        MyEnumerate2.AUTUMN.show();
//
////        Student student = new Student();
////        System.out.println(student.toString());
//    }/
//    public static void main(String[] args) {
//        //注解和注释
////        int age = 20;
//////        System.out.println(age);
////        /**
////         * 注释
////         * */
//        //过时了但是还是可以使用
//        Student student = new Student();
//        System.out.println(student.toString());
//
//
//    }
//    public static void main(String[] args) {
//        //单例模式 -- 该类只想创建一个对象
//
//
//
//    }
//    public static void main(String[] args){
//        //finalize -- 在被垃圾回收机制回收之前会被调用，可以重写（Object类）
////        Student student = new Student("zhangsan",21,Week.FRI);
////        System.out.println(student.toString());
////        student = null;
//        main();
//
//
//
//
//    }
//    public static void main(){
//        System.out.println("这是main方法");
//    }
    public static void main(String[] args) {
        //统一解决

        try{
            method1();
        }catch (ArithmeticException a){
            System.out.println(a.getMessage());
        }
        System.out.println("finally");


    }
    public static void method1() throws ArithmeticException{
        int a = 10;
        System.out.println(a/0);
    }




}
